// Copyright (c) 2005  INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of cgal-python; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; version 2.1 of the License.
// See the file LICENSE.LGPL distributed with cgal-python.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $Id: approximate_sqrt.h 172 2007-11-06 13:36:24Z spion $
// $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal-python/trunk/cgal-python/include/approximate_sqrt.h $
//
// Author(s)     : Naceur Meskini
//=========================================================================

#ifndef CGAL_PYTHON_APPROXIMATE_SQRT_H
#define CGAL_PYTHON_APPROXIMATE_SQRT_H

#include <CGAL/basic.h>
#include <CGAL/Gmpq.h>

CGAL_BEGIN_NAMESPACE

typedef CGAL::Gmpq NT;

inline
NT sqrt(const NT &d)
{
  return CGAL::Gmpq(CGAL_NTS sqrt(CGAL::to_double(d)));
}

CGAL_END_NAMESPACE

#include <CGAL/Lazy_exact_nt.h>

CGAL_BEGIN_NAMESPACE

#if CGAL_VERSION_NR >= 1030301000 // 3.3.0
CGAL_NTS_BEGIN_NAMESPACE
inline
Lazy_exact_nt<Gmpq> sqrt(const Lazy_exact_nt<Gmpq> &d)
{
  return Lazy_exact_nt<Gmpq>(std::sqrt(CGAL::to_double(d)));
}
CGAL_NTS_END_NAMESPACE
#endif

CGAL_END_NAMESPACE

#endif
